function initDate(){
    var now=new Date();
    now.setDate(now.getDate());
    var day = ("0" + now.getDate()).slice(-2);
    var month = ("0" + (now.getMonth() + 1)).slice(-2);
    var MyDate = now.getFullYear()+"-"+(month)+"-"+(day) ;
    $(document.getElementById("tdate")).val(MyDate);
}

function insertTo() {

    var date = document.getElementById("tdate").value;
    var content = document.getElementById("tquestion").value;
    var share = {content: "", date: ""};
    share.content = content;
    share.date = date;
    if(content==""){
        alert("分享内容为空！！！！");
    }
    ajaxCall("POST", path+"/ShareServlet?method=insertTo",getResult,share);

}

function getResult(res){

    var obj = JSON.parse(res);

    ClearTextArea();
    if(obj=="insert"){

        alert("添加成功！");
        location.reload();
    }else{

        alert("更新成功！");
        location.reload();
    }
}
function ClearTextArea()
{
    document.getElementById("tquestion").value="";
}
